

const { ccclass, property, requireComponent } = cc._decorator;

@ccclass
@requireComponent(cc.AudioSource)
export default class AudioManager extends cc.Component {

    @property(cc.AudioClip)
    gameover: cc.AudioClip = null;

    @property(cc.AudioClip)
    drop: cc.AudioClip = null;

    @property(cc.AudioClip)
    lienclear: cc.AudioClip = null;

    @property(cc.AudioClip)
    cursor: cc.AudioClip = null;

    @property(cc.AudioClip)
    balloon: cc.AudioClip = null;


    get AudioSource(): cc.AudioSource {
        return this.getComponent(cc.AudioSource);
    }

    playGameOver() {
        this.AudioSource.clip = this.gameover;
        this.AudioSource.play();
    }

    playDrop() {
        this.AudioSource.clip = this.drop;
        this.AudioSource.play();
    }

    playLineClear() {
        this.AudioSource.clip = this.lienclear;
        this.AudioSource.play();
    }

    playCursor() {
        this.AudioSource.clip = this.cursor;
        this.AudioSource.play();
    }

    playBalloon() {
        this.AudioSource.clip = this.balloon;
        this.AudioSource.play();
    }
}
